package create.prototype;

public class RealCloneable implements Cloneable {

    public RealCloneable() {
        System.out.println("原型对象初始化完毕");
    }

    @Override
    protected RealCloneable clone() throws CloneNotSupportedException {
        return (RealCloneable)super.clone();
    }
}

class Main{
    public static void main(String[] args) throws CloneNotSupportedException {
        RealCloneable r1 = new RealCloneable();
        RealCloneable r2 = r1.clone();
        System.out.println("对象r1和r2是同一个对象？" + (r1==r2));
    }
}
